package com.ruoyi.web.controller.english;

import com.alibaba.fastjson.JSON;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.english.utils.YouDaoUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.Map;


/**
 * @author: user1
 * date: 2021/12/25
 */
@RestController
@RequestMapping("/english")
public class EnglishController {

    @GetMapping("/fanyi")
    public AjaxResult getEnglishInterpret(String word) throws IOException {
        Map<String,Object> res = JSON.parseObject(YouDaoUtil.translateEngilish(word));
        return new AjaxResult(200,"查询成功",res);
    }
}
